import React, { useRef, useState } from 'react';

export default function App() {
  const [count, setCount] = useState(0);
  const inpref = useRef<HTMLInputElement>(null);
  const handleinp = () => {
    console.log(inpref);

    inpref.current?.focus();
  };
  return (
    <div>
      Hello React TS
      <h1>{count}</h1>
      <input type="text" ref={inpref} />
      <button onClick={() => setCount(count + 1)}>点我改变count+1</button>
      <button onClick={handleinp}>获取ref</button>
    </div>
  );
}
